package com.study.spring.netty.time_server;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.charset.StandardCharsets;


public class TimeServerEncode extends MessageToByteEncoder<Object> {

    private final Logger logger = LoggerFactory.getLogger(getClass());


    @Override
    protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
//        out.writeBytes(msg.toString().getBytes(StandardCharsets.UTF_8));
        out.writeBytes(msg.toString().getBytes(StandardCharsets.UTF_8));
    }
}
